require 'stringio'

class Query
  attr_accessor :session_id, :view_id, :is_callback, :action_id
  def initialize
    @session_id = nil
    @is_callback = false
    @action_id = nil
    @view_id = nil
  end

  def to_s
    arr = []
    arr << "sid=#{session_id}" if session_id
    arr << "vid=#{view_id}" if view_id
    arr << "action=#{action_id}" if action_id
    arr << "cb=#{is_callback}"
    "?" + arr.join("&")
  end

end


if __FILE__ == $0
  q = Query.new
  q.session_id = 'XKGQ'
  puts q
end
